﻿namespace Dcms.Common
{
    using log4net;
    using System;
    using System.Reflection;

    public class Log
    {
        public class LogHandler
        {
            private static string dateTime = DateTime.Now.ToString();
            public static Log.LogHandler instance = new Log.LogHandler();
            private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

            public static void LogDebug(string errModule, Exception ex)
            {
                log.Debug(dateTime + "-----在:" + errModule + "模块,错误消息:" + ex.Message.ToString());
            }

            public static void LogError(string errModule, Exception ex)
            {
                log.Error(dateTime + "-----在:" + errModule + "模块,错误消息:" + ex.Message.ToString());
            }

            public static void LogError(string errModule, string ex)
            {
                log.Error(dateTime + "-----在:" + errModule + "模块,错误消息:" + ex.ToString());
            }

            public static void LogInfo(string errModule, Exception ex)
            {
                log.Info(dateTime + "-----在:" + errModule + "模块,错误消息:" + ex.Message.ToString());
            }

            public static void LogWarn(string errModule, Exception ex)
            {
                log.Warn(dateTime + "-----在:" + errModule + "模块,错误消息:" + ex.Message.ToString());
            }
        }
    }
}

